<?php get_header(); ?>
<div class="row-fluid">
	<div class="span12">
		<ul class="thumbnails">
	<?php 
		wp_reset_query();
		$i = 0;
		$per_page =42;
        $type = 'duka';
        $order = 'DESC';
		$category = get_query_var('cat');
		$settings = get_option('dp_shopping_cart_settings');
		$products = get_posts('numberposts=' . $per_page . '&post_type=' . $type . '&category=' . $category);
		if (is_array($products) && count($products) > 0) :
			foreach ($products as $product) {
				$fields = get_post_custom($product->ID);
				$attachment_images = &get_children('post_type=attachment&post_status=inherit&post_mime_type=image&post_parent=' . $product->ID);
				
				if ($i % 4 == 0 && $i > 0) {
	?>
		</ul>	
	</div>
</div>
<div class="row-fluid">
	<div class="span12">
		<ul class="thumbnails">
	<?php } ?>
			<li class="span3 item-wrp">
				<a href="<?php echo get_permalink($product->ID) ?>">
					<?php echo get_the_post_thumbnail($product->ID, array(175, 252));?>
				</a>
				<span class="item item-title"><?php echo $product->post_title; ?></span>
				<span class="item item-pid"><?php echo $fields['pid'][0]; ?></span>
				<span class="item item-price"><?php echo number_format($fields['price'][0]) . ' ' . $settings['dp_currency_symbol']; ?></span>
				<a href="<?php echo get_permalink($product->ID) ?>" class="btn btn-small btn-primary item-detail">Xem chi tiết</a>
			</li>
	<?php	
				$i++;
			}
		endif;
	?>
		</ul>	
	</div>	
</div>
<?php get_footer(); ?>